home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: mstave@wpo.borland.com (Matt Stave)
- Newsgroups: comp.lang.c++
- Subject: Re: BC++ 4.52 - A CodeGuard bug, or mine?
- Date: Tue, 26 Mar 1996 19:29:15 GMT
- Organization: Borland International
- Message-ID: <4j9gk1$efj@druid.borland.com>
- References: <4j6ubq$24l@clarknet.clark.net>
- NNTP-Posting-Host: mstave2.borland.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Joe,
-
- When CodeGuard detects an invalid delete, it attempts to tell you
- where the pointer was allocated.
-
- It could be that the value of the pointer has changed between the
- allocation and the deletion. A changed memory global breakpoint may
- catch this. In addition, you could do:
-
- a = new ...
- b = a;
- ...
- assert ( b==a );
- delete [] a;
-
- Another possibility is heap corruption, take a look at the RTL's heap
- checking functions for more info.
-
- Let me know how it goes.
-
- --- Matt (Borland)
-
-
- budge@clark.net (Joe Budge) wrote:
-
- >I am experiencing a sporadic error message from CodeGuard which
- >makes no sense to me. Any tips that anyone can provide as to
- >what the cause may be or how I may narrow this down would be
- >greatly appreciated.
-
- >I'm building an application under BCPP 4.53 for Windows 3.11
- >using the large memory model. At inconsistent times CodeGuard
- >interrupts with a 'Bad Parameter' message: 'A bad object
- >(0x00000000) has been passed to the function. delete(0xhhhh:hhhh)"
- >[Where h = address of delete() in my .exe]. The lowest level
- >of the call stack with source code always points to the line
- >containing the 'new' operator in one of several code fragments
- >that look like:
-
- > char * szDest ;
- > szDest = new char[n + 1] ;
- > assert( szDest != NULL ) ;
-
- >This is puzzling, as I am not calling delete() anywhere that I
- >can tell in the flagged code (yes, I do call it elsewhere). I
- >can't find anywhere that the BC++ source for operator new() calls
- >delete() either.
-
- >In the above fragment, 'n' is of type size_t and is passed to the
- >function containing the code fragment as a parameter. There doesn't
- >seem to be any relationship between its value and the failure.
-
- >If I set a breakpoint on the offending line or break elsewhere and
- >set watches on either of the variables involved, the failure never
- >occurs. This means I can't tell what's really going on. I've tried
- >initializing szDest to different values - doesn't make a difference.
-
- >Of course I've checked the installation of CodeGuard. There is
- >no apparent problem if I build & run without CodeGuard, and there's
- >no apparent problem if I build & run for 32-bit windows. Now I'm at
- >wit's end and am beginning to suspect that the problem is in
- >CodeGuard, not in anything I've done. Any suggestions would be
- >greatly appreciated.
-
- >Thanks in advance,
- >Joe Budge
-
-
-
-
-